// api/answer.js
import request from '../utils/axios';

export function getPaperSubmissions() {
  return request.get('/answer/list');
}


export function getPaperSubmissionDetail(params) {
  return request({
    url: '/answer/submissionDetail',
    method: 'get',
    params
  });
}

export function submitGradingResult(payload) {
  return request({
    url: '/answer/submitGrading',
    method: 'post',
    data: payload
  });
}

/**
 * 获取学生成绩列表
 * @returns Promise
 */
export function getStudentScores() {
  return request({
    url: '/answer/showStudentScore',
    method: 'get'
  })
}

/**
 * 发送成绩低分预警
 * @param {Object} data 仅需包含 { studentName: string，paperName: string }
 * @returns Promise
 */
export function sendLowScoreWarning(data) {
  return request({
    url: '/answer/sendWarning',
    method: 'post',
    params: data   // 改成 params
  })
}


/* *
* 将学生成绩提出excel表格 */
export function exportScoresExcel() {
  return request({
    url: '/resultExport/exportScores',
    method: 'GET',
    responseType: 'blob' // 必须设置为 blob，方便浏览器下载
  });
}